#!/bin/tcsh -ef
#############################################################################
#                                                                           #
# Title: AUX-Stop FREALIGN run				                          		#
#                                                                           #
# (C) 2dx.org, GNU Plublic License.                                         #
#                                                                           #
# Created..........: 29/07/2016                                             #
# Last Modification: 29/07/2016                                             #
# Author...........: 2dx.org                                                #
#                                                                           #
#############################################################################
#
# SORTORDER: 110
#
#
# MANUAL: This script stops a current run of FREALIGN.
#
# DISPLAY: SPR_DIR
# DISPLAY: SPR_FRLRefOrPreref
# DISPLAY: SPR_PREREFINE_DIR
# DISPLAY: SPR_REFINE_DIR
#
#$end_local_vars
set SPR_DIR = ""
set dir_frealign = ""
set SPR_FRLRefOrPreref = ""
set SPR_FREALIGN_DIR = ${SPR_DIR}/FREALIGN/

set scriptname = StopFREALIGNRun

#$end_vars

if ( -e LOGS/${scriptname}.results ) then
	mv LOGS/${scriptname}.results LOGS/${scriptname}.results.old
endif

# Form the strings:

if ( ${SPR_FRLRefOrPreref} == "refine" ) then
	set SPR_FRLRefOrPreref = ${SPR_REFINE_DIR}
else
	set SPR_FRLRefOrPreref = ${SPR_PREREFINE_DIR}
endif
	
cd ${SPR_FREALIGN_DIR}/${SPR_FRLRefOrPreref}

${dir_frealign}/bin/frealign_kill

cd ${OLDPWD}
